package io.github.mayubao.kotlintest

import org.junit.Assert
import org.junit.Assert.assertEquals
import org.junit.Test

class Day5_LoopTest{

    @Test
    fun testForLoop(){
        val list = listOf("apple", "balana", "pear")
        var count = 0;
        for(l  in list){
            println("fruit name is $l")
            count ++;
        }
        assertEquals(count, list.size)
    }


    @Test
    fun testForEach() {
        val list = listOf("apple", "balana", "pear")
        var count = 0
        list.forEach {
            x -> println("fruit name is $x")
            count++
        }
        assertEquals(count, list.size)
    }

}